package com.zhl.interface_Demo8;

import java.util.ArrayList;

//班级
public class ClassManager {
    //创建一个容器 用于存储学生
    private ArrayList<Student> students = new ArrayList<Student>();
    //只需要更改右边，就可以达到 通过更换接口，来实现不同方法的效果
    private StudentOperator op = new StudentOperatorIpml1();
    //private StudentOperatorIpml2 op2 = new StudentOperatorIpml2();

    public  ClassManager(){
        students.add(new Student("小明", 87, '男'));
        students.add(new Student("小红", 90, '女'));
        students.add(new Student("小刚", 85, '男'));
        students.add(new Student("小李", 92, '女'));
        students.add(new Student("小王", 88, '男'));
        students.add(new Student("小张", 95, '女'));
        students.add(new Student("小刘", 89, '男'));
        students.add(new Student("小周", 93, '女'));
        students.add(new Student("小吴", 86, '男'));
        students.add(new Student("小郑", 92, '女'));
        students.add(new Student("小陈", 100, '男'));
        students.add(new Student("小杨", 71, '女'));
    }
    //打印学生信息
    public void printAllStudents(){
        op.printAllStudents(students);
    }

    //打印班级的平均分数
    public void printAvergeScore(){
        op.printAvergeScore(students);

    }

}
